package com.jadcon.bedbreakfast.domain;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("Suite Service")
public class SuiteServiceImpl implements SuiteService {

	@Autowired()
	private SuiteRepository suiteRepository;

	
	public Suite getNumber(int number) throws SQLException {
		return suiteRepository.getNumber(number);
	}

	public List<Suite> getSuiteList() throws SQLException {
		return suiteRepository.getSuiteList();
	}

	public void save(Suite suite) {
		suiteRepository.save(suite);
		
	}
	
	// added try\catch on 10-07-10
	public Suite getName(String name) throws SQLException {
		try {
			return suiteRepository.getName(name);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	// added try\catch on 10-07-10
	public Suite getImageName(String imageName) throws SQLException {
		try {
			return suiteRepository.getImageName(imageName);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public Suite getSuiteByNumber(int number) throws SQLException {
		try {
			Suite suite = new Suite();
			suite = suiteRepository.getSuiteByNumber(number);
			return suite;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	

}
